<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义属性</title>
    <style>
        .button {
            background-color: #4CAF50; /* Green */
            border: none;
            color: white;
            padding: 15px 32px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="exp1"></div>



<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/javascript" src="../js/prop-types.js"></script>

<script type="text/babel">

    //父组件
    class WebSite extends React.Component{
        constructor(){
            super();
            this.state = {
                name:"紫牛小筑",
                site:"http://www.hzqiuxm.com"
            }
        }

        render(){
            return(
              <div>
                <Name name = {this.state.name}/>
                <Link site = {this.state.site}/>
              </div>
            );
        }
    }

    //子组件
    class Name extends React.Component{
        constructor(){
            super();
        }
        render(){
            return(
                <div>
                    <h1>{this.props.name}</h1>
                    <button className="button">一个按钮</button>
                </div>
            );
        }
    }

    //子组件
    class Link extends React.Component{
        constructor(){
            super();
        }
        render(){
            return(
                <a href={this.props.site}>
                    {this.props.site}
                </a>

            );
        }
    }

  ReactDOM.render(<WebSite/>,document.getElementById("exp1"))

</script>
</body>
</html>